<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <title>Document</title>
  <style>

  </style>
</head>

<body>
  <script src="./axios.js"></script>
</body>
<script>
  //全局配置   写url会很方便
  axios.defaults.baseURL = 'http://www.itcbc.com:3006'


  let a = axios.get('/api/province')
  let b = axios.get('/api/city', { params: { pname: '河北省' } })
  let c = axios.get('/api/county', { params: { pname: '河北省', cname: '承德市' } })



  //前一个then返回的promise的对象,对象的结果会被下一个then得到


  a.then(result => {
    console.log(result.data)
    return b
  }).then(result => {
    console.log(result.data)
    return c
  }).then(result => {
    console.log(result.data);
  }).catch(error => {
    console.log(error);
  })
</script>

</html>